#ifndef _APPLICATION_H
#define _APPLICATION_H
#include <appConfig.h>
#include <SoftTimerTask.h>
#include "systick_device.h"
#include <taskManager.h>

typedef enum{
  UART_STATE_WAIT_SOF = 0,
  UART_STATE_WAIT_FRAME_ID,
  UART_STATE_WAIT_PEC,
  UART_STATE_WAIT_LENGTH,
  UART_STATE_WAIT_DATA,
}UART_State_t;

#define UART_SOF        0x55
#define UART_SOF_RSP    0xA5

#define UART_FRAME_TYPE_RX                0 //received data from sender for slave;
#define UART_FRAME_TYPE_TX                1 //data request from sender for slave;

typedef struct{
  uint8_t SOF;
  uint8_t frameId;
  uint8_t pec;
  union{
    struct{
        uint8_t checksum      : 1;
        uint8_t frameType     : 3;
        uint8_t framelength   : 4;
    };
    uint8_t payload;
  };
  uint8_t data[8];
}UartDataFrame_t;



















#endif